﻿#quick and dirty

param(
[Parameter(Mandatory=$true)]	[string] $Index,
[Parameter(Mandatory=$true)]	[string] $VSIP,
[Parameter(Mandatory=$true)]	[String] $VSName,
[Parameter(Mandatory=$true)]	[int] $VSPort,
[Parameter(Mandatory=$true)]	[int] $VSProtocol,
[Parameter(Mandatory=$true)]	[string] $VSAddrType,
[Parameter(Mandatory=$true)]	[string] $VSschedulingMethod,
[Parameter(Mandatory=$true)]	[string] $VSpersistenceTimeout,
[Parameter(Mandatory=$true)]	[string] $VScheckerType,
#[Parameter(Mandatory=$true)]	[string] $VSadaptiveMethod,
[Parameter(Mandatory=$true)]	[int] $VSnumDests
#[Parameter(Mandatory=$true)]	[string] $VSl7persist,
#[Parameter(Mandatory=$true)]	[string] $VSl7cookieId

)

	[Threading.Thread]::CurrentThread.CurrentCulture = "en-US"        
    [Threading.Thread]::CurrentThread.CurrentUICulture = "en-US"
	$api = New-Object -comObject 'MOM.ScriptAPI'

	$bag = $api.CreatePropertyBag()
	#Put the gathered statistics into the property bag.  
	#Includes a value for the folder name so that we can tell which folder the data is from.
	$bag.AddValue('Index',$Index)
	$bag.AddValue('VSIP',$VSIP)
	$bag.AddValue('VSName',$VSName)
	$bag.AddValue('VSPort',$VSPort)
	switch ($VSProtocol)
	{
		6 {$port='tcp';break;}
		17 {$port = 'udp'; break;}
		default {$port = $VSProtocol ;}
	}
	$bag.AddValue('VSProtocol',$port)
	switch ($VSAddrType)
	{
	    0 {$AddrType='Unknown';break;}
		1 {$AddrType='IPv4';break;}
		2 {$AddrType= 'IPv6'; break;}
		16 {$AddrType= 'DNS'; break;}
		default {$AddrType = $VSAddrType;}
	}	
	$bag.AddValue('VSAddrType',$AddrType)
	$bag.AddValue('VSschedulingMethod',$VSschedulingMethod)	
	$bag.AddValue('VSpersistenceTimeout',$VSpersistenceTimeout)
	$bag.AddValue('VScheckerType',$VScheckerType)	
	#$bag.AddValue('VSadaptiveMethod',$VSadaptiveMethod)	
	$bag.AddValue('VSnumDests',$VSnumDests)	
	#$bag.AddValue('VSl7persist',$VSl7persist)
	#$bag.AddValue('VSl7cookieId',$VSl7cookieId)
	#Return each property bag as we create and populate it.
	
	$bag
